define(function() {
	return function($compile, $scope) {
		require([ "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar",
				"PDUtilDir/inputSelect",
				"AppPathDir/product/lineInfos/support",
				"AppPathDir/product/lineInfos/add",
				"AppPathDir/product/lineInfos/update",
				"AppPathDir/product/lineInfos/delete",
				"css!AppPathDir/product/lineInfos/views/css/line" ], function(
				Util, Tool, Slidebar, inputSelect, Support, AddSupport,
				UpdateSupport, DelSupport) {
			$scope.search = {};
			$scope.cache = {
				types : new Array()
			};
			/* 查询 start */
			$scope.searchSupport = {
				run : function() {
					$scope.grid.reload({
						queryParam : $scope.search
					})
				}
			};
			/* 查询 end */
			$scope.addSupport = AddSupport($scope, $compile);
			$scope.updateSupport = UpdateSupport($scope, $compile);
			$scope.delSupport = DelSupport($scope, $compile);

			// 加载数据到缓存 start
			$.ajax({
				url : getServer() + "/flea/hclv/getTourism.htmls",
				success : function(data) {
                    if (data.status != 200) {
                        return;
                    }
					$scope.cache.types = data.data;
					/* 初始化公共组件 start */
					$scope.grid = Support.init($scope.cache.types,
							$scope.addSupport, $scope.updateSupport,
							$scope.delSupport, $scope.searchSupport);
					
					inputSelect.dropCache();
					inputSelect({
						id : "queryType",
						key : {
							id : "dictCode",
							name : "dictName",
							data : "data",
						},
						data : $scope.cache.types,
						simpleData : true,
						searchAble : false,
						callback : function(id, data) {
							$scope.search.type = id[0];
						}
					});
				}
			});
		})
	}
});